Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.naming
Class Catalog<K,V>

    java.lang.Object
      rdlc.naming.Catalog<K,V>

Direct Known Subclasses:
  HierarchicalCatalog

    public class Catalog<K,V>

extends java.lang.Object

A catalog of bindings from keys to values. Notice that this is NOT the same as a hash table, as this catalog will maintain an ordering on the bindings in it. While this is not part of the formal definition of a catalog, it is sometimes nessecary. For example is the fields of a struct.

Version:
  $Revision: 1.9 $
Author:
  Greg Gibeling

Field Summary
`protected java.util.Vector<Binding<K,V>>` | `entryList` List of entries in this catalog, in order, of course.
`protected java.util.Hashtable<K,java.lang.Integer>` | `indexTable` The actual hashtable underlying this catalog.

Constructor Summary
`Catalog()` Base constructor, creates an empty catalog.
`Catalog(Catalog<K,V> other)` Copy constructor.

Method Summary
`void` | `clear()` Clear this catalog of all bindings.
`boolean` | `containsKey(K _key)` Determine if this catalog has a binding for the given key.
`java.util.List<Binding<K,V>>` | `entryList()` Return an ordered list of the bindings in this catalog.
`V` | `get(int index)` Lookup the given index in this catalog and return the value at that position.
`V` | `get(K _key)` Lookup the given key in this catalog and return the value to which it is bound.
`K` | `getKey(int index)` Lookup the given index in this catalog and return the key at that position.
`boolean` | `isEmpty()` Simple accessor.
`java.util.Set<K>` | `keySet()` Get the set of all the keys in this catalog.
`V` | `put(int index, V _value)` Change the value at the given index.
`V` | `put(K _key, V _value)` Create or change a binding from the given key to the given value.
`void` | `putAll(Catalog<K,V> _catalog)` Copy all of the bindings from the given catalog into this one.
`V` | `remove(K _key)` Remove the current binding for the given key in this catalog.
`int` | `size()` Simple accessor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### indexTable

    protected java.util.Hashtable<K,java.lang.Integer> indexTable

  The actual hashtable underlying this catalog. Stores indices into the value list, which we then look in for the value during `get()`.

  See Also:
    `get(Object)`

### entryList

    protected java.util.Vector<Binding<K,V>> entryList

  List of entries in this catalog, in order, of course.

Constructor Detail

### Catalog

    public Catalog()

  Base constructor, creates an empty catalog.

### Catalog

    public Catalog(Catalog<K,V> other)

  Copy constructor.

  Parameters:
    `other` - Catalog to copy.

Method Detail

### size

    public int size()

  Simple accessor.

  Returns:
    The number of bindings in this catalog.

### isEmpty

    public boolean isEmpty()

  Simple accessor.

  Returns:
    `true` if this catalog is empty.

### containsKey

    public boolean containsKey(K _key)

  Determine if this catalog has a binding for the given key.

  Parameters:
    `_key` - The key to check for.
  Returns:
    `true` if the `_key` is bound in this catalog.

### get

    public V get(K _key)

  Lookup the given key in this catalog and return the value to which it is bound.

  Parameters:
    `_key` - The key to lookup in this catalog.
  Returns:
    The value to which the key was bound.

### get

    public V get(int index)

  Lookup the given index in this catalog and return the value at that position.

  Parameters:
    `index` - The index to look up in this catalog.
  Returns:
    The value at the given index.

### getKey

    public K getKey(int index)

  Lookup the given index in this catalog and return the key at that position.

  Parameters:
    `index` - The index to look up in this catalog.
  Returns:
    The key at the given index.

### put

    public V put(K _key,
                 V _value)

  Create or change a binding from the given key to the given value.

  Parameters:
    `_key` - The key to which we must bind the value.
    `_value` - The value to bind to the key.
  Returns:
    The old value to which the key was bound.

### put

    public V put(int index,
                 V _value)

  Change the value at the given index. This will effectively rebind the key at that index.

  Parameters:
    `index` - The index of the value to change.
    `_value` - The value to put at that index.
  Returns:
    The old value to which the key was bound.

### putAll

    public void putAll(Catalog<K,V> _catalog)

  Copy all of the bindings from the given catalog into this one. This is a by-reference copy of the keys and values. That means that if one of the values is changed through the other catalog, the `get()` method of this catalog will return the new value.

  Parameters:
    `_catalog` - The catalog to copy into this one.

### remove

    public V remove(K _key)

  Remove the current binding for the given key in this catalog. This also returns the value to which that key was bound. For now this method is unimplemented.

  Parameters:
    `_key` - The key to remove from this catalog.
  Returns:
    The old value to which this key was bound.

### clear

    public void clear()

  Clear this catalog of all bindings.

### entryList

    public final java.util.List<Binding<K,V>> entryList()

  Return an ordered list of the bindings in this catalog. This can then be used to generate an iterator or enumeration to handle each value bound in this catalog. Note that any modifications to the returned list might invalidate this catalog.

  Returns:
    An list of the bindings in this catalog.

### keySet

    public final java.util.Set<K> keySet()

  Get the set of all the keys in this catalog.

  Returns:
    The set of all keys in this catalog.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD